//
//  NSString+Verify.m
//  LRPDemo
//
//  Created by 周文帅 on 15/8/28.
//  Copyright (c) 2015年 zhou. All rights reserved.
//

#import "NSString+Verify.h"

@implementation NSString (Verify)
- (BOOL)verifyEmailAddress{//验证邮箱;
    NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
    return [emailTest evaluateWithObject:self];
}
- (BOOL)verifyTelephone{//验证手机号;
    NSString *pattern = @"^1+[3578]+[0-9]{9}";
    NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern];
    BOOL isMatch = [pred evaluateWithObject:self];
    return isMatch;
}
@end
